export class What_is_this extends plugin {
  constructor() {
    super({
      name: "芝士什么",
      dsc: "叽叽叽",
      event: "message",
      priority: 1145141919810,
      rule: [
        {
          reg: "^#?(芝士|这是)什么$",
          fnc: "芝士"
        }
      ]
    })
  }

  async 芝士(e) {
    if (!e.source) return false
    let source = e.isGroup ? (await e.group.getChatHistory(e.source.seq)).pop() : (await e.friend.getChatHistory(e.source.time)).pop()

    if (!source) return false
    const { message } = source
    if (!Array.isArray(message) || message.length < 1) return false

    let msg = "芝士"
    let type = []

    for (const i of message) {
      switch (i.type) {
        case "text":
          type.push("文字")
          break
        case "image":
          type.push("图片")
          break
        case "file":
          type.push("文件")
          break
        case "at":
          if (i.qq === "all") {
            type.push("艾特全体")
          } else {
            type.push("艾特")
          }
          break
        case "markdown":
          type.push("Markdown")
          break
        case "button":
          type.push("按钮")
          break
        case "raw":
          type.push("原始消息")
          break
        case "json":
          type.push("卡片消息")
          break
        case "long_msg":
          type.push("龙消息")
          break
        case "face":
          type.push("表情")
          break
        case "bface":
          type.push("表情包")
          break
        default:
          type.push("雪豹")
          break
      }
    }

    msg += type.join("、")
    return e.reply(msg, true)
  }
}